﻿#pragma once

#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRep_Tool.hxx>
#include <Geom2dAPI_Interpolate.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <STEPControl_Reader.hxx>
#include <STEPControl_Writer.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>

#undef min
#undef max
#undef near
#undef far

#include <learn/alg/alg_projection.h>
#include <learn/geom/vec.h>
#include <learn/utils/adaptor_occ.h>

/**
 * @brief 用曲线裁剪曲面
 *
 * @param[in] curves
 * @param[in] surface
 * @return TopoDS_Shape
 */
TopoDS_Shape generate_trimmed_face(const std::vector<std::shared_ptr<xi::geom::Geom_BSplineCurve<3>>> &curves,
                                   std::shared_ptr<xi::geom::Geom_BSplineSurface<3>> surface);

/**
 * @brief 读取 stp 文件
 *
 * @param[in] path
 * @return std::vector<TopoDS_Shape>
 */
std::vector<TopoDS_Shape> read_stp(const char *path);

/**
 * @brief 写入 stp 文件
 *
 * @param[in] shapes
 * @param[in] path
 */
void write_stp(const std::vector<TopoDS_Shape> &shapes, const char *path);